const mongoose = require('mongoose')
const schema = mongoose.Schema({
  create_time: { type: Number, required: true }, // 创建时间
  update_time: { type: Number, required: true }, // 最后修改时间
  order: { type: Number, required: true },
  name: { type: String, required: true }, // 标题
  title: { type: String, default: '' },
  description: { type: String, default: '' },
  keywords: { type: String, default: '' },
  content: { type: String, default: '' }, // md
  html: { type: String, default: '' },
  desc: { type: String, default: '' },
  theme: { type: String, default: null },
  code: { type: String, default: null },
  classificationId: { type: String, default: null }, // 分类id
  groupId: { type: String, default: null }, // 组id
  tags: { type: Array, default: [] }, // 标签
  preview_url: { type: String, default: null },
  alt: { type: String, default: '' },
  hot: { type: Boolean, default: false }, // 是否推荐
  like: { type: Array, default: [] }, // 点赞
  page_view: { type: Number, default: 0 }, // 浏览量
  comment: { type: Array, default: [] } // 评论
})

schema.index({ order: -1 })
schema.index({ order: 1 })

module.exports = mongoose.model('ArticleList', schema, 'article-list')
